import Vue from 'vue'
import VueRouter from 'vue-router'
import loginindex from '@/views/login/index.vue'
import layout from '@/views/layout/index.vue'
import chat from '@/views/layout/chat.vue'
import friend from '@/views/layout/friend.vue'
import login from '@/views/login/login.vue'
import register from '@/views/login/register.vue'
import editMyInfo from '@/views/layout/editInfo.vue'
Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/loginindex',
      component: loginindex,
      children: [
        { path: '/login', component: login },
        { path: '/register', component: register }
      ]
    },
    {
      path: '/layout',
      component: layout,
      children: [
        { path: '/chat/:id', component: chat },
        { path: '/friend', component: friend },
        { path: '/editmyinfo', component: editMyInfo }
      ],
      redirect: '/chat/0'
    },
    { path: '/', component: layout, redirect: '/chat/0' }
  ]
})

export default router
